package com.gulimall.authserver;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;

/**
 * 核心原理：
 *
 * @EnableRedisHttpSession：导入了RedisHttpSessionConfiguration配置 1.    RedisOperationsSessionRepository   redis操作session，session的增删改查的封装类
 * 2.放了SessionRepositoryFilter  session存储过滤器  每个请求过来都要经过filter
 * 1.创建的时候，就自动从容器中获取到了sessionRepository；
 * 2.原始的request，response都被包装了  SessionRepositoryRequestWrapper,SessionRepositoryResponseWrapper
 * 3.以后获取session、request.getSession（）；
 * 4.wrappedRequest.getSession();==>SessionRespository中获取到的
 * <p>
 * 装饰者模式：
 * 自动延期：Redis中的数据也是有过期时间的
 */


//整合Redis作为session存储
@EnableRedisHttpSession
@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication
public class GulimallAuthServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(GulimallAuthServerApplication.class, args);
    }

}
